<?php
/*
 * 装饰模式使用类似结构来帮组我们改变具体组件的功能,该模式同样体现了组合的重要性，但组合是在代码运行时实现的。
 *
 *
 */
function my_autoloader($class) {
    //var_dump($class);
    include $class . '.php';
}
spl_autoload_register('my_autoloader');


$tile = new Plains();
print $tile->getWealthFactor()."\n<BR/>";

$tile = new DiamondDecorator(new Plains);
print $tile->getWealthFactor()."\n<BR/>";

$tile = new PollutionDecorator(new DiamondDecorator(new Plains));
print $tile->getWealthFactor()."\n<BR/>";


$tile = new PollutionDecorator(new Plains);
print $tile->getWealthFactor()."\n<BR/>";
